import axios from 'axios';

//----------------部门管理-------------

// 获取list
export function getDeptList(params:any) {
  return axios.get('/permission/dept/', {
    params,
  });
}
// 增 
export function createDept(data:any) {
  return axios.post('/permission/dept/', data);
}
// 改
export function updateDept(data:any,id:any) {
  return axios.put(`/permission/dept/${id}/`, data);
}
// 删 
export function deleteDept(id:any) {
  return axios.delete(`/permission/dept/${id}/`);
}
// 树形tree
export function getDeptTree() {
  return axios.get('/permission/deptTree/');
}

//----------------角色管理-------------

// 获取list
export function getRoleList(params:any) {
  return axios.get('/permission/role/', {
    params,
  });
}
// 增 
export function createRole(data:any) {
  return axios.post('/permission/role/', data);
}
// 改
export function updateRole(data:any,id:any) {
  return axios.put(`/permission/role/${id}/`, data);
}
// 删 
export function deleteRole(id:any) {
  return axios.delete(`/permission/role/${id}/`);
}

//----------------职位管理-------------

// 获取list
export function getPostList(params:any) {
  return axios.get('/permission/post/', {
    params,
  });
}
// 增 
export function createPost(data:any) {
  return axios.post('/permission/post/', data);
}
// 改
export function updatePost(data:any,id:any) {
  return axios.put(`/permission/post/${id}/`, data);
}
// 删 
export function deletePost(id:any) {
  return axios.delete(`/permission/post/${id}/`);
}

//----------------用户管理-------------

// 获取list
export function getUserList(params:any) {
  return axios.get('/permission/user/', {
    params,
  });
}

// 增 
export function createUser(data:any) {
  return axios.post('/permission/user/', data);
}
// 改
export function updateUser(data:any,id:any) {
  return axios.put(`/permission/user/${id}/`, data);
}
// 删 
export function deleteUser(id:any) {
  return axios.delete(`/permission/user/${id}/`);
}

// 更新用户密码
export function updateUserPwd(id: any,password:any) {
  return axios.post<any>(`/permission/user/${id}/resetPasswd/`, password);
}


export function queryPolicyList(params:any) {
  return axios.get('/list/policy', {
    params,
  });
}
export function queryInspectionList() {
  return axios.get('/list/quality-inspection');
}

export function queryTheServiceList() {
  return axios.get('/list/the-service');
}

export function queryRulesPresetList() {
  return axios.get('/list/rules-preset');
}
